Ext.define('BM.controller.BoxBrowsers', {
    extend: 'Ext.app.Controller',
	views:  ['main.BoxBrowser'],
	stores: ['Boxs'],
	models: ['Box'],
    init: function() {
    
         this.control({
            'boxbrowser': {
                itemdblclick: this.fireBoxSelected,
                selectionchange:this.onBoxSelect,
                itemcontextmenu:this.onBoxContextMenu
            },
            'boxcontextmenu':{
                click: this.onBoxContextMenuClick
            }
        });
    },
      //双击选择指定的包间
     fireBoxSelected: function(view,record,item,index,e) {
     	
        alert("Box:"+record.get("id"));
    },
    //单击选中指定的包间
    onBoxSelect: function(dataview, selections) {
    
    	this.onShowOrderInfo();
    },
    //单击包间鼠标右键时的菜单
    onBoxContextMenu:function(view,record,item,index,e){
    	e.stopEvent();
        var _menu = Ext.widget('boxcontextmenu');
        _menu.showAt(e.getXY());
        return false;
    },
   
    //单击包间右键菜单的一个选项时
    onBoxContextMenuClick:function(menu,item,e){
    
    	//alert("Box: "+item.text);
    }
});